package concurrent.BlockingQueue;

import java.util.UUID;
import java.util.concurrent.BlockingQueue;

public class Producer implements Runnable{  
	  
    protected BlockingQueue queue = null;  
  
    public Producer(BlockingQueue queue) {  
        this.queue = queue;  
    }  
  
    public void run() {  
        try {  
        	for(int i=0; i<100; i++) {
        		queue.put(UUID.randomUUID().toString());
//        		queue.put(i);  
                Thread.sleep(50);
        	}
        } catch (InterruptedException e) {  
            e.printStackTrace();  
        }  
        System.out.println("Producer线程结束");
    }  
}  